% input=imread('Berea_Final_Pattern.bmp','bmp');
% input=input/255;

input=imread('E2.bmp','bmp');
input=input(:,:,1)/255;

inp=input;
%input=input';
%intput=rot90(input);
[lx,ly]=size(input);

% A=zeros(lx,ly);
% input=[input,A];

A=zeros(lx,ly);
input=[input;A];


lz=11;
[lx,ly]=size(input);

fid = fopen('Emily_BC.dat','wt');

% for k=1:lz
%     for j=1:ly
%         for i=1:lx+2
%             
%         if ((i==1) || (i==lx+2) ||(k==1) ||(k==lz))
%             if(j<=ly/2)
%             fprintf(fid,'%1d\n',1);
%             else
%                 fprintf(fid,'%1d\n',0);
%             end
%         else
%         fprintf(fid,'%1d\n',input(i-1,j));
%         end
%         
%         end
%     end
%     k
% end


 for k=1:lz
    for j=1:ly+2
        for i=1:lx
            
        if ((j==1) || (j==ly+2) ||(k==1) ||(k==lz))
            if(i<=lx/2)
                fprintf(fid,'%1d\n',1);
            else
                fprintf(fid,'%1d\n',0);
            end
        else
        fprintf(fid,'%1d\n',input(i,j-1));
        end
        
        end
    end
    k
end






lx
ly+2
lz
